﻿<!DOCTYPE HTML>
<html>
<head>
<title>用户列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<#include "/views/ftl/base/manager_include.ftl">
<link href="${basePath}umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="${basePath}umeditor/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${basePath}umeditor/umeditor.min.js"></script>
<script type="text/javascript" src="${basePath}umeditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body style="background:#eef3f7;">
<#include "/views/ftl/base/head.ftl">
<div class="Main">
  <div class="dw">
<#include "/views/ftl/base/menu.ftl">
<#function a><#return "帖子列表_List"></#function> 
      <!--右边内容-->
 	<div class="Rightbox fl">
        <!--面包屑-->
        <div class="Bread_crbs clear">
          <div class="Bread_crbs_img fl"></div>
          <div class="Bread_crbs_text fl">
          	<a href="javascript:;">
          		<span>论坛管理-></span>
          	</a>
          	<span class="fnt_famy"></span>
          	<a href="javascript:;">
          		<span>帖子管理</span>
          	</a>
          </div>
        </div>
        <!--各种表单设置-->
        <form id="post_infor" name="post_infor" action="${basePath}manager/Post_savePost" method="post">
        <input type="hidden" name="image" id="image" value="">
        <div class="bd_box">
          <div class="input_name">
            <span>标题：</span><input type="name" id="subject" maxlength="250" name="subject" placeholder="请输入帖子标题" style="width:350px;"/>
          </div>
          <div class="input_name">
            <span>模块：</span>
	        <select type="name" name="themeId" id="themeId">
	        	<option value="0">全部</option>
		         <#if (themeList??)> 
		         <#if ((themeList?size)>0)>
		          <#list themeList as bean>
	        		<option value="${bean.id?c}">${(bean.name)!''}</option>
		          </#list >
		          </#if>
		          </#if>
	        </select>
          </div>
          <div class="clear"></div>
          <div class="explain">
            <div class="explain_name">内容：</div>
			<!--style给定宽度可以影响编辑器的最终宽度-->
			<script type="text/plain" id="myEditor" style="width:1000px;height:340px;">
			</script>
            <textarea name="content" id="content" style="display:none;"></textarea>
          </div>
        </div>
        <div class="button">
          <a href="javascript:;"><input type="button" id="save_button" name="button" value="保存" /></a>
        </div>
        <!--批量上传-->
        <div class="batch">
            <div class="batchname">更多图片：</div>
            <ul id="post_images">
                <li >
                    <a  href="javascript:void(0);" class="batchbox">
                        <img id="image1" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(1);" id="del_image_1" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg"/></em>
                       	<input type="hidden" name="imageValue" id="imageValue1" value="">
                        <p id="image_li_1">图片1</p>
                    </a>
                </li>
                <li >
                    <a  href="javascript:void(0);" class="batchbox">
                        <img id="image2" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(2);" id="del_image_2" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue2" value="">
                        <p id="image_li_2">图片2</p>
                    </a>
                </li>
                <li >
                    <a  href="javascript:void(0);" class="batchbox">
                        <img id="image3" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(3);" id="del_image_3" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue3" value="">
                        <p id="image_li_3">图片3</p>
                    </a>
                </li>
                <li >
                    <a href="javascript:void(0);" class="batchbox">
                        <img id="image4" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(4);" id="del_image_4" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue4" value="">
                        <p id="image_li_4">图片4</p>
                    </a>
                </li>
                <li >
                    <a  href="javascript:void(0);" class="batchbox">
                        <img id="image5" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(5);" id="del_image_5" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue5" value="">
                        <p id="image_li_5">图片5</p>
                    </a>
                </li>
                <li >
                    <a  href="javascript:void(0);" class="batchbox">
                        <img id="image6" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(6);" id="del_image_6" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue6" value="">
                        <p id="image_li_6">图片6</p>
                    </a>
                </li>
                <li >
                    <a href="javascript:void(0);" class="batchbox">
                        <img id="image7" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(7);" id="del_image_7" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue7" value="">
                        <p id="image_li_7">图片7</p>
                    </a>
                </li>
                <li >
                    <a href="javascript:void(0);" class="batchbox">
                        <img id="image8" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(8);" id="del_image_8" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue8" value="">
                        <p id="image_li_8">图片8</p>
                    </a>
                </li>
                <li >
                    <a  href="javascript:void(0);" class="batchbox">
                        <img id="image9" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(9);" id="del_image_9" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue9" value="">
                        <p id="image_li_9">图片9</p>
                    </a>
                </li>
                <li >
                    <a href="javascript:void(0);" class="batchbox">
                        <img id="image10" src="${basePath}images/manager/up_pl.jpg" />
                        <em onclick="javascript:imageDelete(10);" id="del_image_10" class="batch_close" style="display:none;"><img src="${basePath}images/manager/batch_close.jpg" /></em>
                       	<input type="hidden" name="imageValue" id="imageValue10" value="">
                        <p id="image_li_10">图片10</p>
                    </a>
                </li>
            </ul>
            <div class="clear"></div>
        </div>
        </form>
      </div>
  </div>
</div>

<!--上传图片弹出框-->
<#include "../base/image_upload.ftl">
<script type="text/javascript">
//加载文本编辑器
var um = UM.getEditor('myEditor');
$().ready(function() {
	$("#save_button").click(function(){
		savePostInfo();
    });
    
    $("#image_li_1,#image1").click(function(){
    	imageUploadDiv('image1','imageValue1','del_image_1');
    });
    $("#image_li_2,#image2").click(function(){
    	imageUploadDiv('image2','imageValue2','del_image_2');
    });
    $("#image_li_3,#image3").click(function(){
    	imageUploadDiv('image3','imageValue3','del_image_3');
    });
    $("#image_li_4,#image4").click(function(){
    	imageUploadDiv('image4','imageValue4','del_image_4');
    });
    $("#image_li_5,#image5").click(function(){
    	imageUploadDiv('image5','imageValue5','del_image_5');
    });
    $("#image_li_6,#image6").click(function(){
    	imageUploadDiv('image6','imageValue6','del_image_6');
    });
    $("#image_li_7,#image7").click(function(){
    	imageUploadDiv('image7','imageValue7','del_image_7');
    });
    $("#image_li_8,#image8").click(function(){
    	imageUploadDiv('image8','imageValue8','del_image_8');
    });
    $("#image_li_9,#image9").click(function(){
    	imageUploadDiv('image9','imageValue9','del_image_9');
    });
    $("#image_li_10,#image10").click(function(){
    	imageUploadDiv('image10','imageValue10','del_image_10');
    });
});
//删除
function imageDelete(i){
	$("#del_image_"+i).css("display","none");
	$("#image"+i).attr("src","${basePath}images/manager/up_pl.jpg");
	$("#imageValue"+i).val("0");
	$("#image_upload_div").hide();
}
//保存帖子信息
function savePostInfo(){
	if($.trim($('#subject').val()) == ''){
		alert("标题不能为空！");
		return;
	}
	var themeId = $('#themeId').val();
	if(themeId==0){
		alert("请选择吗帖子模块！");
		return;
	}
	var content = UM.getEditor('myEditor').getContent();
	if($.trim(content) == ''){
		alert("内容不能为空！");
		return;
	}else{
		$('#content').val(content)
	}
	var images = "";
	$("input[name='imageValue']").each(
		function(){  
			var image = $(this).val();
			if((image!='0')&&($.trim(image)!='')){
				images+=image+",";
			}
	  	}  
	 )
	 $('#image').val(images);
	 $('#post_infor').submit();
}
</script>
</body>
</html>
